
export default {

    transObj(name){
        const params = sessionStorage.getItem(name)
        try{
          const info = JSON.parse(params)
           return info 
        }catch{
            return params
        }
        
    },


    transStr(name,payload){
      if(typeof(payload) == 'object'){
          payload = JSON.stringify(payload)
      }
      sessionStorage.setItem(name,payload)
  },

    removeToken:(name)=>{
      sessionStorage.removeItem(name)
  },
  
  getToken(){
     let token = sessionStorage.getItem('token')
     let userInfo = sessionStorage.getItem('userInfo') 
     if(userInfo){
       try{
         userInfo = JSON.parse(userInfo)
       }catch{

       }
     }
     return {token,userInfo}

  }
 
} 